package com.xiaochang.em.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiaochang.em.entity.Star;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface StarMapper extends BaseMapper<Star> {

    //查看全部
    @Select("select * from electronic_mall.star_data")
    List<Star> allStar();

    //添加恒星数据
    @Insert("insert into star_data values (#{id},#{obSid},#{designation},#{obsDate}," +
            "#{lmjd},#{mjd},#{planid},#{spid},#{fiberid},#{snru},#{snrg},#{snrr},#{snri}" +
            ",#{snrz},#{subClass},#{z},#{ra},#{dec},#{logg},#{rv},#{teff},#{feh})")
    Boolean save(Star star);

    /*按条件查询*/
    @Select("select * from electronic_mall.star_data where subclass = #{subClass}")
    List<Star> queryByClass(String subClass);

    @Select("select * from electronic_mall.star_data where obsid = #{obSid}")
    Star queryById(String obSid);

    /*实现登录*/
    @Select("select * from electronic_mall.star_data where id = #{id} and obsid = #{obSid}")
    Boolean login(Integer id,String obSid);

}
